// pages/details/details.js\
const wxParse = require('../../wxParse/wxParse.js');

const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    domain: app.api.domain,
    autoplay: true,
    currentSwiper: 0,
    remaining: '',
    promtypes: ['默认', '抢购', '团购', '优惠促销', '预售', '虚拟', '拼团', '新人商品促销'],
    cartCount: 0,
    partData: {
      imgUrls: '',
      name: '',
      inventory: 0,
      price: '',
      detail:true
    },
    goodsId: null,
    sum: '1',
    detailData: null,
    navId: 'a1',
    tabId: 'b1',
    evaluateId: 'e1',
    toggle: true,
    collect: false,
    sort: true,
    evaluateList: [],
    evaluateNavList: 1,
    showEvaluate: true,
    carriage: null,
    showCarriage: true,
    specification: null, //规格
    first: 0, //超出配送范围商品首次进入页面等于1，大于1之后不再显示超出配送范围
    page: 1,
    frequency: true,
    noGoodsContent: true,
    noVideo: false,
    type: 0, //渠道会员type =1
    pos_type: '',
    x: 0,
    y: 300,
    playroomId: '', //直播id
    isshowplay: false, //是否显示直播按钮
    playstatus: false, //直播状态
    lngLog: {}, //当前经纬度
    userInfos: '',
    nowStoreId: '', //当前店铺id
    showShare: false
  },

  // 视频播放
  bindPlay: function () {
    const that = this;
    that.videoContext.play()
    that.setData({
      autoplay: false
    })
  },
  // 视频暂停
  bindPause: function () {
    const that = this;
    that.videoContext.pause()
    that.setData({
      autoplay: true
    })
  },
  // 轮播图自定义索引点
  swiperChange(e) {
    this.setData({
      currentSwiper: e.detail.current
    })
  },

  // 点击收藏
  tabCollect(e) {
    app.checkUserInfoAuthorizationCart().then(() => {
      const that = this;
      let json = {
        token: app.globalData.token,
        goods_id: e.currentTarget.dataset.goodsid
      }
      let jsonData = app.utils.getSignData(json);
      app.utils.post(app.api.reqUrls.delCollection, jsonData).then(res => {
        if (res.status == 1) {
          that.setData({
            collect: !that.data.collect
          })
          wx.showToast({
            title: res.msg,
            icon: 'success',
            duration: 1000
          })
        } else {
          throw res.msg
        }
      }).catch(err => {
        app.showInfo(err.toString())
      })
    })

  },
  // 点击添加购物车
  showClick() {
    const that = this;
    that.setData({
      toggle: false,
      'partData.detail': true,
    })
  },
  // 点击头部3个选项
  navClick(e) {

    const that = this;

    //滚动条回到顶部
    wx.pageScrollTo({
      scrollTop: 0,
      duration: 0
    })
    that.setData({
      navId: e.currentTarget.dataset.navid
    })
  },
  // 跳转到商品详情
  skipDetails(e) {
    const that = this;
    that.setData({
      goodsId: e.currentTarget.dataset.goodid,
      first: 1
    })
    that.getData();
    wx.pageScrollTo({
      scrollTop: 0,
      duration: 300
    })
    // that.dispatching()
  },
  // 点击查看图文详情
  examine() {
    const that = this;
    //滚动条回到顶部
    wx.pageScrollTo({
      scrollTop: 0,
      duration: 0
    })
    that.setData({
      navId: 'a2'
    })
  },
  // 详情内2个选项
  tabClick(e) {
    const that = this;
    that.setData({
      tabId: e.currentTarget.dataset.tabid
    })
  },
  // 用户评价
  evaluateRoute() {
    const that = this;

    that.setData({
      navId: 'a3'
    })
  },
  // 用户评价选项
  evaluateClick(e) {
    const that = this;
    that.setData({
      evaluateId: e.currentTarget.dataset.evaluateid
    })
    switch (that.data.evaluateId) {
      case 'e1':
        that.setData({
          evaluateNavList: 1,
          page: 1,
          frequency: true
        })
        break;
      case 'e2':
        that.setData({
          evaluateNavList: 2,
          page: 1,
          frequency: true
        })
        break;
      case 'e3':
        that.setData({
          evaluateNavList: 3,
          page: 1,
          frequency: true
        })
        break;
      case 'e4':
        that.setData({
          evaluateNavList: 4,
          page: 1,
          frequency: true
        })
        break;
      case 'e5':
        that.setData({
          evaluateNavList: 5,
          page: 1,
          frequency: true
        })
        break;
    }

    let goods_id = that.data.goodsId;
    let jsons = {
      goods_id: goods_id,
      type: that.data.evaluateNavList

    }
    let jsonDatas = app.utils.getSignData(jsons);
    that.setData({
      hiddenLoading: false
    })
    app.utils.post(app.api.reqUrls.evaluate, jsonDatas).then(res => {
      that.setData({
        hiddenLoading: true
      })
      if (res.status == 1) {
        if (res.result == '') {
          that.setData({
            showEvaluate: false
          })
        } else {
          // 格式化时间
          res.result.forEach((item, index) => {
            item.ctime = app.moment(item.add_time * 1000).format('YYYY-MM-DD');
            // item.ctime = app.moment(item.ctime).fromNow();
          })
          //判断是微信端的评价还是app端的评价
          res.result.forEach(res => {
            if (res.head_pic == '') {
              res.head_pic = '/static/avatar.png';
            } else {
              if (res.head_pic.substring(0, 5) == 'https') {
                return false;
              } else {
                res.head_pic = that.data.domain + res.head_pic
              }
            }
          })
          //判断是否匿名
          res.result.forEach(res => {
            if (res.is_anonymous == 0) {
              res.nickname = '匿名用户';
              res.head_pic = '/static/avatar.png';
            }
          })
          //判断是否有评价
          if (res.result == '') {
            that.setData({
              showEvaluate: false
            })
          } else {
            that.setData({
              evaluateList: res.result,
              showEvaluate: true
            })
          }

        }
      } else {
        throw res.msg
      }
    }).catch(err => {
      that.setData({
        hiddenLoading: true
      })
      app.showInfo(err.toString())
    })
  },

  // 点击立即购买
  toFillOrder(e) {
    console.log(e)
    app.checkUserInfoAuthorizationCart().then(() => {
      wx.navigateTo({
        url: `/page/detail/pages/fillOrder/fillOrder?goodsid=${e.detail.goodsid}&goodsnum=${e.detail.goodsnum}`
      })
    })
  },

  // 跳转购物车
  toCart() {
    const that = this;
    wx.switchTab({
      url: '/page/tabBar/cart/cart',
    })
  },
  //跳转到首页
  toIndex() {
    wx.switchTab({
      url: '/page/tabBar/index/index',
    })
  },
  // 添加到购物车
  // addToCart(e) {
  //   const that = this;
  //   let valid = e.currentTarget.dataset.valid;
  //   if (valid == 0) {
  //     app.showInfo('此商品不存在或者已下架');
  //     return
  //   }
  //   app.checkUserInfoAuthorizationCart().then(() => {
  //     let goodsid = e.currentTarget.dataset.goodsid;
  //     let token = app.globalData.token;
  //     let json = {
  //       token,
  //       goods_num: 1,
  //       goods_id: goodsid,
  //     }
  //     let jsonData = app.utils.getSignData(json);
  //     app.utils.post(app.api.reqUrls.addCart, jsonData).then(res => {
  //       if (res.status == 1) {
  //         // 添加成功
  //         wx.showToast({
  //           title: '已添加到购物车',
  //           icon: 'success',
  //           duration: 1000
  //         })
  //         app.getCartCount();
  //         app.cartCountCallback = (res) => {
  //           that.setData({
  //             cartCount: res
  //           })
  //         }
  //       } else {
  //         throw res.msg;
  //       }
  //     }).catch(err => {
  //       app.showInfo(err.toString())
  //     })
  //   })
  // },
  // 点击添加购物车
  addShowCart(e) {
    const that = this;
    let goods = e.currentTarget.dataset.goods
    that.setData({
      toggle: false,
      'partData.imgUrls': goods.img,
      'partData.name': goods.goods_name,
      'partData.inventory': goods.store_count,
      'partData.price': goods.shop_price,
      'partData.goods_id': goods.goods_id,
      'partData.detail': false,
    })
  },
  // 添加到购物车
  addToCart(e) {
   
    app.checkUserInfoAuthorizationCart().then(() => {
      const that = this;
      let token = app.globalData.token;
      let json = {
        token,
        goods_num: e.detail,
        goods_id: that.data.partData.goods_id,
      }
      let jsonData = app.utils.getSignData(json);
      app.utils.post(app.api.reqUrls.addCart, jsonData).then(res => {
        if (res.status == 1) {
          wx.showToast({
            title: '添加成功',
            icon: 'success',
            duration: 2000
          })
          app.getCartCount();
          app.cartCountCallback = (res) => {
            that.setData({
              cartCount: res
            })
          }
        } else {
          throw res.msg
        }
      }).catch(err => {
        app.showInfo(err.toString())
      })

    })
  },
  // 底部加入购物车
  addCart(e) {
    
    app.checkUserInfoAuthorizationCart().then(() => {
      const that = this;
      that.setData({
        sum: e.detail,
        
      })
      let token = app.globalData.token;
      let json = {
        token,
        goods_num: that.data.sum,
        goods_id: that.data.goodsId,
      }
      let jsonData = app.utils.getSignData(json);
      app.utils.post(app.api.reqUrls.addCart, jsonData).then(res => {
        if (res.status == 1) {
          wx.showToast({
            title: '添加成功',
            icon: 'success',
            duration: 2000
          })


          app.getCartCount();
          app.cartCountCallback = (res) => {
            that.setData({
              cartCount: res
            })
          }
        } else {
          throw res.msg
        }
      }).catch(err => {
        app.showInfo(err.toString())
      })

    })

  },

  // 获取倒计时
  getRemaining(end, current) {
    const that = this;
    clearInterval(that.data.time)
    let remain = end - current;
    that.setData({
      remain
    })
    if (Number.isNaN(remain)) {
      return
    }
    let time = setInterval(() => {
      if (that.data.remain > 0) {
        remain = remain - 1000;
      }
      // app.moment(remain).format('YYYY-MM-DD HH:mm:ss')
      let h = '';
      let day = '';
      if (app.moment(remain).format('HH') >= 8) {
        h = parseInt(app.moment(remain).format('HH')) - 8
        day = parseInt(app.moment(remain).format('DD')) - 1;
      } else {
        h = parseInt(app.moment(remain).format('HH')) + 16
        day = parseInt(app.moment(remain).format('DD')) - 2;
      }
      if (day > 0) {
        var remaining = day + '天' + h + app.moment(remain).format(':mm:ss');
      } else {
        var remaining = h + app.moment(remain).format(':mm:ss');
      }
      that.setData({
        remaining,
        remain
      })
    }, 1000)
    that.setData({
      time
    })
  },
  // 获取数据
  getData() {
    const that = this;
    let token = app.globalData.token;
    let page = that.data.page;
    let json = {
      token,
      id: that.data.goodsId,
      page: page,
    }
    that.setData({
      hiddenLoading: false
    })
    let jsonData = app.utils.getSignData(json);
    app.utils.post(app.api.reqUrls.goodsInfo, jsonData).then(res => {
      that.setData({
        hiddenLoading: true
      })
      if (res.status == 1) {
        // res.result.activity.prom_price = parseFloat(res.result.activity.prom_price).toFixed(2);
        // if (res.result.activity.prom_price != undefined) {
        //   res.result.activity.prom_price = res.result.activity.prom_price.toString().split('.');
        // }
        app.getImg(res.result.recommend_goods);
        // that.getRemaining(res.result.activity.prom_end_time * 1000, res.result.activity.server_current_time * 1000)
        res.result.recommend_goods.forEach(item => {
          item.sales_sum = '销量' + ' ' + item.sales_sum
        });

        that.setData({
          noVideo:res.result.goods.video == '' ? false : true,
          collect:res.result.goods.is_collect == 0 ? true : false, //  判断是否收藏
          detailData: res.result,
          'partData.imgUrls': res.result.gallery.length ? res.result.gallery[0].image_url : '/static/thum.jpg',
          'partData.name': res.result.goods.goods_name,
          'partData.inventory': res.result.goods.store_count,
          'partData.price': res.result.goods.prom_type == 0 ? (that.data.type == 1 ? res.result.goods.channel_price : res.result.goods.shop_price) : res.result.goods.shop_price
        })
        //当前店铺id
        that.setData({
          nowStoreId: res.result.store.store_id,
        })
      } else if (res.status == -1) {

        wx.showModal({
          content: res.msg,
          confirmText: '我知道了',
          confirmColor: '#ff5151',
          showCancel: false,
          success(e) {
            if (e.confirm) {
              wx.navigateBack({
                delta: -1
              })
            }
          }
        })
      } else {
        throw res.msg
      }
    }).catch(err => {
      app.showInfo(err.toString())
      that.setData({
        hiddenLoading: true
      })
    })
    let jsons = {
      goods_id: that.data.goodsId,
      type: that.data.evaluateNavList
    }
    let jsonDatas = app.utils.getSignData(jsons);
    app.utils.post(app.api.reqUrls.evaluate, jsonDatas).then(res => {
      if (res.status == 1) {
        //判断是微信端的评价还是app端的评价
        res.result.forEach(res => {
          //时间格式化
          res.ctime = app.moment(res.add_time * 1000).format('YYYY-MM-DD');
          if (res.store_reply) {
            res.store_reply.forEach(r => {
              r.ctime = app.moment(r.add_time * 1000).format('YYYY-MM-DD');
            })
          }
          if (res.head_pic == '') {
            res.head_pic = '/static/avatar.png';
          } else {
            res.head_pic = (res.head_pic.startsWith('http') || res.head_pic.startsWith('https')) ? res.head_pic : that.data.domain + res.head_pic
          }
          //判断是否匿名
          if (res.is_anonymous == 0) {
            res.nickname = '匿名用户';
            res.head_pic = '/static/avatar.png';
          }
        })
        //判断是否有评价
        if (res.result == '') {
          that.setData({
            showEvaluate: false
          })
        } else {
          that.setData({
            evaluateList: res.result,
            showEvaluate: true
          })
        }
      } else {
        throw res.msg
      }
    }).catch(err => {
      app.showInfo(err.toString())
    })
    //获取商品图片详情
    let jsonp = {
      id: that.data.goodsId,
      is_json: 1
    }
    let jsonDatap = app.utils.getSignData(jsonp);
    app.utils.post(app.api.reqUrls.goodsContent, jsonDatap).then(res => {
      if (res.status == 1) {
        // 解析富文本
        if (res.result.goods_content != "") {
          var article = res.result.goods_content;
          wxParse.wxParse('article', 'html', article, that, 0);
          that.setData({
            specification: res.result.param,
            noGoodsContent: true
          })
        } else {
          that.setData({
            noGoodsContent: false
          })
        }
      } else {
        throw res.msg
      }
    })
  },
  // 评价缩率图
  previewImage(e) {
    const that = this;
    console.log(e.currentTarget.dataset.index);
    if (that.data.evaluateList[e.currentTarget.dataset.index].img == '') {
      return false;
    } else {
      wx.previewImage({
        current: e.currentTarget.dataset.url, // 当前显示图片的http链接
        urls: that.data.evaluateList[e.currentTarget.dataset.index].img // 需要预览的图片http链接列表
      })
    }

  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    const that = this;
    app.globalData.globuserid = options.users_id;
    const tokens = app.globalData.token; //获取本地自定义登录态
    if (options.store_id) {
      wx.setStorageSync('shadowstoreid', options.store_id);
    }
    if (options.users_id) {
      if (!tokens) {
        wx.navigateTo({
          url: '/page/tabBar/login/login',
        })
      }
    }
    var salemanId = wx.getStorageSync("shadowuserid");
    console.log('取得分享参数参数 === ' + salemanId)
    if (salemanId) {
      //本地储存缓存过期时间,1800000 则是 1800s
      var timestamp = Date.parse(new Date());
      var data_expiration = wx.getStorageSync("data_expiration");
      if (data_expiration) {
        if (timestamp > data_expiration) {
          wx.clearStorageSync("shadowuserid")
          wx.clearStorageSync("data_expiration")
          console.log('无时间清空所有参数')
          if (options.users_id) {
            console.log('再次拿到--分享进入参数参数')
            if (app.globalData.token) {
              app.getInfo(app.globalData.token, () => {
                console.log(app.globalData.userInfo.user_id, 12344321)
                if (app.globalData.userInfo.user_id == options.users_id) {
                  console.log('相同id不写入')
                } else {
                  var codeKey = options.users_id;
                  wx.setStorageSync('shadowuserid', codeKey);
                  var timestamp = Date.parse(new Date());
                  var expiration = timestamp + 86400000; //缓存24小时
                  // var expiration = timestamp + 120000; //缓存2分钟
                  wx.setStorageSync("data_expiration", expiration)
                  console.log('再次写入参数参数111===' + codeKey)
                }
              })
            }
          } else {
            console.log('再次写入空参数参数')
          }


        } else {
          console.log('有效期时间段')
        }
      } else {
        console.log('无时间有效期')
        var expiration = timestamp + 86400000; //缓存24小时
        // var expiration = timestamp + 120000; //缓存2分钟
        wx.setStorageSync("data_expiration", expiration)
      }
    } else {
      console.log('无分享参数参数')
      if (options.users_id) {
        console.log('拿到--分享进入参数参数')
        if (app.globalData.token) {
          app.getInfo(app.globalData.token, () => {
            console.log(app.globalData.userInfo.user_id, 12344321)
            if (app.globalData.userInfo.user_id == options.users_id) {
              console.log('相同id 不写入')
            } else {
              var codeKey = options.users_id;
              wx.setStorageSync('shadowuserid', codeKey);
              var timestamp = Date.parse(new Date());
              var expiration = timestamp + 86400000; //缓存24小时
              // var expiration = timestamp + 120000; //缓存2分钟
              wx.setStorageSync("data_expiration", expiration)
              console.log('写入参数参数111===' + codeKey)
            }
          })
        } else {
          console.log('没有登录')
        }
      } else {
        console.log('写入空参数参数')
      }
    }
    let goods_id = options.id;
    that.setData({
      pos_type: options.type
    })
    if (options.orderid == undefined) {
      that.setData({
        goodsId: goods_id,
        navId: 'a1'
      })
    } else {
      that.setData({
        goodsId: goods_id,
        navId: 'a3'
      })
    }
    wx.getSystemInfo({
      success(res) {
        that.setData({
          scrollHeight: res.windowHeight - 156 / 750 * res.windowWidth
        });
      }
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function (res) {
    this.videoContext = wx.createVideoContext('myVideo')
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function (options) {

    var salemanId = wx.getStorageSync("shadowuserid");
    console.log('取得分享参数参数 === ' + salemanId)
    if (salemanId) {
      //本地储存缓存过期时间,1800000 则是 1800s
      var timestamp = Date.parse(new Date());
      var data_expiration = wx.getStorageSync("data_expiration");
      if (data_expiration) {
        if (timestamp > data_expiration) {
          wx.clearStorageSync("shadowuserid")
          wx.clearStorageSync("data_expiration")
          console.log('无时间清空所有参数')
          if (options.users_id) {
            console.log('再次拿到--分享进入参数参数')
            if (app.globalData.token) {
              app.getInfo(app.globalData.token, () => {
                console.log(app.globalData.userInfo.user_id, 12344321)
                if (app.globalData.userInfo.user_id == app.globalData.globuserid) {
                  console.log('相同id不写入')
                } else {
                  var codeKey = app.globalData.globuserid;
                  wx.setStorageSync('shadowuserid', codeKey);
                  var timestamp = Date.parse(new Date());
                  var expiration = timestamp + 86400000; //缓存24小时
                  // var expiration = timestamp + 120000; //缓存2分钟
                  wx.setStorageSync("data_expiration", expiration)
                  console.log('再次写入参数参数111===' + codeKey)
                }
              })
            }
          } else {
            console.log('再次写入空参数参数')
          }
        } else {
          console.log('有效期时间段')
        }
      } else {
        console.log('无时间有效期')
        var expiration = timestamp + 86400000; //缓存24小时
        // var expiration = timestamp + 120000; //缓存2分钟
        wx.setStorageSync("data_expiration", expiration)
      }
    } else {
      console.log('无分享参数参数')
      if (app.globalData.globuserid) {
        console.log('拿到--分享进入参数参数')
        if (app.globalData.token) {
          app.getInfo(app.globalData.token, () => {
            console.log(app.globalData.userInfo.user_id, 12344321)
            if (app.globalData.userInfo.user_id == app.globalData.globuserid) {
              console.log('相同id 不写入')
            } else {
              var codeKey = app.globalData.globuserid;
              wx.setStorageSync('shadowuserid', codeKey);
              var timestamp = Date.parse(new Date());
              var expiration = timestamp + 86400000; //缓存24小时
              // var expiration = timestamp + 120000; //缓存2分钟
              wx.setStorageSync("data_expiration", expiration)
              console.log('写入参数参数111===' + codeKey)
            }
          })
        } else {
          console.log('没有登录')
        }
      } else {
        console.log('写入空参数参数')
      }
    }

    const that = this;
    app.cartCountCallback = (res) => {
      that.setData({
        cartCount: res
      })
    }
    app.getCartCount();
    // 判断是否渠道会员，type == 1是渠道会员
    if (app.globalData.token) {
      that.setData({
        type: 0
      })
    }
    that.getData();
  },


  //显示分享
  shareShow() {
    const that = this;
    that.setData({
      hiddenLoading: false
    })
    let json = {
      token: app.globalData.token,
      id: that.data.goodsId
    }
    let jsonDatas = app.utils.getSignData(json);
    app.utils.post(app.api.reqUrls.getcreateShowPic, jsonDatas).then(res => {
      that.setData({
        hiddenLoading: true,
      })
      if (res.status == 1) {
        that.setData({
          showShare: true
        })
        throw res.msg;
      } else {
        throw res.msg;
      }
    }).catch(err => {
      app.showInfo(err.toString())
    })
  },

  // 下拉加载评论
  lower(e) {
    const that = this;
    if (!that.data.frequency) {
      return false;
    }
    let page = that.data.page;
    console.log(page)
    page += 1;
    let jsons = {
      goods_id: that.data.goodsId,
      type: that.data.evaluateNavList,
      p: page
    }
    let jsonDatas = app.utils.getSignData(jsons);
    that.setData({
      hiddenLoading: false
    })
    app.utils.post(app.api.reqUrls.evaluate, jsonDatas).then(res => {
      that.setData({
        hiddenLoading: true
      })
      if (res.status == 1) {
        console.log(res.result)

        if (res.result == '') {
          wx.showToast({
            title: '没有更多了',
            icon: "none",
            duration: 1000
          })
          that.setData({
            frequency: false
          })
          return false;
        } else {
          // 格式化时间
          res.result.forEach((item) => {
            item.ctime = app.moment(item.add_time * 1000).format('YYYY-MM-DD');
            // item.ctime = app.moment(item.ctime).fromNow();
            if (item.store_reply) {
              item.store_reply.forEach(res => {
                res.ctime = app.moment(res.add_time * 1000).format('YYYY-MM-DD');
              })
            }

          })
          //判断是微信端的评价还是app端的评价
          res.result.forEach(res => {
            if (res.head_pic == '') {
              res.head_pic = '/static/avatar.png';
            } else {
              if (res.head_pic.substring(0, 5) == 'https') {
                return false;
              } else {
                res.head_pic = that.data.domain + res.head_pic
              }
            }
          })

          //判断是否匿名
          res.result.forEach(res => {
            if (res.is_anonymous == 0) {
              res.nickname = '匿名用户';
              res.head_pic = '/static/avatar.png';
            }
            if (res.head_pic == '') {
              res.head_pic = '/static/avatar.png';

            }
          })
          //判断是否有评价
          if (res.result == '') {
            that.setData({
              showEvaluate: false
            })
          } else {
            let evaluateList = that.data.evaluateList;
            res.result.forEach(res => {
              evaluateList.push(res)
            })
            that.setData({
              page: page,
              evaluateList,
              showEvaluate: true
            })
          }
        }

      } else {
        throw res.msg
      }
    }).catch(err => {
      that.setData({
        hiddenLoading: true
      })
      app.showInfo(err.toString())
    })
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    const that = this;
    let titleImg = that.data.detailData.gallery[0].image_url

    return {
      title: `${that.data.detailData.goods.goods_name}`,
      imageUrl: titleImg,
      path: `page/detail/pages/details/details?id=${that.data.goodsId}&first_leader=${app.globalData.userInfo.user_id}`,
    }
  },
  onUnload() {
    const that = this;
    clearInterval(that.data.time)
  }
})